package bar;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

import org.h2.jdbcx.JdbcDataSource;

public class Bar {

	public static void main(String[] args) {
		
		
		JdbcDataSource ds = new JdbcDataSource();
		ds.setURL("jdbc:h2:c:/jlee/tmp/jeopardy");
		ds.setUser("jeopardy");
		ds.setPassword("'tis a secure password ha!");
		try{
			Connection conn = ds.getConnection();
			
			
			Statement s = conn.createStatement();
			
			
			/************* create users *****/
			//s.execute("drop table users");
			//s.execute("CREATE TABLE USERS (ID bigint auto_increment, NAME varchar(12), PASS char(64))");
			
			
			//s.execute("drop table current_games");
			//s.execute("CREATE TABLE CURRENT_GAMES (ID varchar(36), waiting int, start_time timestamp)");
			
			//s.execute("drop table CURRENT_USERS");
			//s.execute("CREATE TABLE CURRENT_USERS (NAME varchar(12), in_game varchar(36))");
			
			//s.execute("drop table GAME_RECORDS");
			//s.execute("CREATE TABLE GAME_RECORDS (ID bigint auto_increment, creator varchar(12), winner varchar(12), " + 
			//	"points_won int, start_time timestamp, gamelog blob)"
			//);
			
			/************* show users ******************
			ResultSet rs = s.executeQuery("select * from users");
			while(rs.next()){
				System.out.println(rs.getString(1) + " : " + rs.getString(2) + ":" + rs.getString(3));
			}           */
			
			s.close();
			conn.close();
			
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	
	

}
